package com.zhiyin.seal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhiyin.seal.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ApprovalDao extends BaseMapper {

    ApprovalProcessEntity selectApprovalProcessById(@Param("id") Long id);

    List<ApprovalProcessEntity> selectApprovalProcessList(@Param("companyId") Long companyId);

    List<ApprovalProcessEntity> selectApprovalProcessListBySealId(@Param("sealId") Long sealId);

    Integer updateApprovalProcess(@Param("approval") ApprovalProcessEntity approvalProcessEntity);

    Integer deleteApprovalProcess(@Param("processId") Long processId);

    Integer deleteCompanyApprovalProcess(@Param("companyId") Long companyId);

    List<ApprovalUserEntity> selectApprovalUserList(@Param("processId") Long processId);

    List<ApprovalCCEntity> selectApprovalCCList(@Param("processId") Long processId);

    Integer insertApprovalProcess(@Param("approvalProcess") ApprovalProcessEntity approvalProcessEntity);

    Integer insertApprovalUserList(@Param("processId") Long processId,@Param("approvalUserList") List<ApprovalUserEntity> approvalUserEntityList);

    Integer insertApprovalCCList(@Param("processId") Long processId,@Param("approvalCCList") List<ApprovalCCEntity> approvalCCEntityList);

    Integer deleteApprovalUserList(@Param("processId") Long processId);

    Integer deleteApprovalUser(@Param("userId") Long userId,@Param("companyId") Long companyId);

    Integer deleteApprovalCCList(@Param("processId") Long processId);

    Integer deleteApprovalCC(@Param("userId") Long userId,@Param("companyId") Long companyId);

    Integer deleteApprovalProcessBySealId(@Param("sealId") Long sealId);

    Long selectApprovalProcessId(@Param("sealId") Long sealId,@Param("departmentIds") List<Long> departmentIds,@Param("companyId") Long companyId);

    Integer selectHasApprovalProcess(@Param("sealId") Long sealId,@Param("departmentId") Long departmentId,@Param("companyId") Long companyId);

    ApprovalProcessEntity selectApprovalProcessByNameSealIdCompanyId(@Param("name") String name,@Param("sealId") Long sealId,@Param("companyId") Long companyId);
}